<template>

  <div id="yonghu">


<!--
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="关键字">
        <el-input v-model="formInline.name" placeholder="关键字"></el-input>
      </el-form-item>

      <el-form-item label="房源名称">
        <el-input v-model="formInline.houseName" placeholder="房源名称"></el-input>
      </el-form-item>


      <el-form-item>
        <el-button type="primary" @click="initData">查询</el-button>
      </el-form-item>
    </el-form>-->



    <el-table
      ref="multipleTable"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
<!--      <el-table-column
        label="日期"
        width="120">
        <template slot-scope="scope">{{ scope.row.date }}</template>
      </el-table-column>-->
      <el-table-column
        prop="userId"
        label="编号"
        width="120">
      </el-table-column>
      <el-table-column
        prop="fa"
        label="商户法人"
        show-overflow-tooltip>
      </el-table-column>

      <el-table-column
        prop="email"
        label="商户邮箱"
        show-overflow-tooltip>
      </el-table-column>
      <el-table-column
        prop="birthday"
        label="生日"
        show-overflow-tooltip>
      </el-table-column>
      <el-table-column
        prop="age"
        label="年龄"
        show-overflow-tooltip>
      </el-table-column>
      <el-table-column
        prop="hobby"
        label="爱好"
        show-overflow-tooltip>
      </el-table-column>
      <el-table-column
        prop="phonenumber"
        label="商户手机号"
        show-overflow-tooltip>
      </el-table-column>
      <el-table-column
        prop="hstatus"
        label="审核状态">
        <template slot-scope="scope">
          <span v-if="scope.row.hstatus==0">未审核
             <el-button type="primary" @click="he(scope.row)">审核</el-button>
          </span>
          <span v-if="scope.row.hstatus==1">已审核</span>
        </template>
      </el-table-column>


      <el-table-column
        label="操作"
        align="center"
        width="160"
        class-name="small-padding fixed-width">
        <template slot-scope="scope" >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:user:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:user:remove']"
          >删除</el-button>
          <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
            <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item command="handleResetPwd" icon="el-icon-key"
                                v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
              <el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
                                v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>


    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="current"
      :page-sizes="sizes"
      :page-size="size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>

</template>

<script>



import {lists} from "@/api/wishu/yonghu";

export default {

  name: "yonghu",
  data(){
    return {
      tableData:[],
      multipleSelection:[],
      current:1,
      sizes:[2,3,5,10],
      size:5,
      total:0,
     /* formInline:{
        name:"",
        houseName:"",
      },*/
    }
  },
  created:function(){
    this.initData();
  },
  methods: {
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    initData(){
      lists(this.current,this.size/*,this.formInline*/).then((res)=>{
        console.log(res)
        this.tableData=res.records;
        this.total=res.total;
      })
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.size=val;
      this.initData();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.current=val;
      this.initData();
    },
    he(row){
      this.axios.get("http://localhost:6100/shang/he",{
        params:{
          userId:row.userId,
        }
      }).then((response) => {
          this.initData();
      })
    }
  }
}
</script>

<style scoped>

</style>
